package com.nowcoder.community;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
//@ShellComponent
@MapperScan(basePackages = { "com.nowcoder.community.mapper" })
@RestController
@SpringBootApplication
public class NowcoderCommunityApplication {

    private static int port;

    @Value("${server.port}")
    public void setPort(int port) {
        this.port = port;
    }

    public static void main(String[] args) {
        SpringApplication.run(NowcoderCommunityApplication.class, args);
        log.info("Your Web port is: ==> {}", "http://127.0.0.1:" + port + "/community/index");
    }

    @GetMapping(path = "/hello")
    public String hello() {

        return "Hello, nowCoder";
    }

//    @ShellMethod("Add two integers together.")
    public int add(int a, int b) {
        return a + b;
    }

}
